alpha-zero-general | A clean implementation based on AlphaZero for any game | Machine Learning library
kandi X-RAY | alpha-zero-general Summary
kandi X-RAY | alpha-zero-general Summary
A simplified, highly flexible, commented and (hopefully) easy to understand implementation of self-play based reinforcement learning based on the AlphaGo Zero paper (Silver et al). It is designed to be easy to adopt for any two-player turn-based adversarial game and any deep learning framework of your choice. A sample implementation has been provided for the game of Othello in PyTorch, Keras, TensorFlow and Chainer. An accompanying tutorial can be found here. We also have implementations for GoBang and TicTacToe. To use a game of your choice, subclass the classes in Game.py and NeuralNet.py and implement their functions. Example implementations for Othello can be found in othello/OthelloGame.py and othello/{pytorch,keras,tensorflow,chainer}/NNet.py. Coach.py contains the core training loop and MCTS.py performs the Monte Carlo Tree Search. The parameters for the self-play can be specified in main.py. Additional neural network parameters are in othello/{pytorch,keras,tensorflow,chainer}/NNet.py (cuda flag, batch size, epochs, learning rate etc.).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Train the model
- Execute the episode
- Calculates the probability of the given canonical board
- Play game
- Play num games
- Returns if game ended
- Calculate the score of a board
- Returns the combined score for a player
- Get the health score for a player
- Check if game ended
- Compute the probability of the given canonical board
- Calculate the score of a player
- Play the board
- Load train examples
- Encode multiple boards
- Returns the valid moves for the player
- Get the next state of the player
- Get the valid moves
- Returns 0 if game ended
- Predict action
- Determine if the game ended
- Determine if the player ended
- Gets the next state in the board
- Get all symmetries for a board
- Get the next state of a board
- Play a board
- Called when a json input is received
alpha-zero-general Key Features
alpha-zero-general Examples and Code Snippets
Community Discussions
Trending Discussions on alpha-zero-general
QUESTION
I am currently trying to grasp Surag Nair's work regarding neural networks.
In (https://github.com/suragnair/alpha-zero-general/blob/master/othello/keras/OthelloNNet.py) There is this line of code:
...ANSWER
Answered 2019-Jul-27 at 11:05You have a misconception, Reshape
is a layer that performs the reshaping operation, it does not "return a shape". It takes a symbolic input tensor and returns the reshaped tensor, given the shape in the constructor.
The problem in our code is that the shapes are not right, a shape is a tuple with integers, it seems your tuple contains another tuple inside, and that is not supported. This code works fine as an example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install alpha-zero-general
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page